<?php

namespace Commands;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Payload\PayloadLoader;

class Yii2Command extends BaseCommand
{
    protected function configure()
    {
        $this->name="yii2";
        parent::configure();
        $this->setDescription("Support version as follow: 2.0.37_1, 2.0.37_2, 2.0.37_3, ")
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $cmd = $input->getArgument("cmd");
        $version = $input->getArgument("version");
        $encode = $input->getOption("encode");
        $payload = PayloadLoader::getPayload($this->getName(),$version,$cmd);
        if($encode){
            $payload = $this->encode($encode, $payload);
        }
        $output->writeln("$payload");
        return 0;
    }
}